﻿<script type="text/template" id="device-class-create-edit-template">
<!--
  DeviceHive Admin Console templates

  Copyright (C) 2016 DataArt

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

-->
    <div class="panel panel-default">
        <div class="panel-heading"><h3 class="panel-title">Detail view of device "<%= name%>"</h3></div>
        <div class="panel-body">
            <div class="form-horizontal col-lg-6">
                <div class="form-group">
                    <label class="col-lg-3 control-label">Id:</label>
                    <div class="col-lg-9">
                        <div class="device-value form-static-text"><%= id%></div>
                        <div class="new-value  form-static-text"><%= id%></div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-lg-3 control-label">Name:</label>
                    <div class="col-lg-9">
                        <div class="device-value form-static-text"><%= name%></div>
                        <input type="text" class="new-value name form-control" value="<%= name%>"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-lg-3 control-label">Operation:</label>
                    <div class="col-lg-9">
                        <div class="device-value form-static-text"><%= isBlocked ? "Blocked" : "Normal" %></div>
                        <select class="new-value form-control" name="isBlocked">
                            <option value="0">Normal</option>
                            <% if (!isBlocked) { %>
                                <option value="1" >Blocked</option>
                            <% } else { %>
                                <option value="1" selected="selected">Blocked</option>
                            <% } %>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-lg-3 control-label">Network:</label>
                    <div class="col-lg-9">
                        <div class="device-value form-static-text"><%= network.name%></div>
                        <select class="new-value network form-control">
                            <% _.each(networks,function(net) {
                                if(net.id == network.id){ %>
                                    <option value="<%= net.id %>" selected="selected"> <%= net.name %> </option>
                                <%}else{ %>
                                    <option value="<%= net.id %>"> <%= net.name %> </option>
                            <%}}); %>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-lg-3 control-label">Device Type:</label>
                    <div class="col-lg-9">
                        <div class="device-value form-static-text"><%= deviceType.name%></div>
                        <select class="new-value device-type form-control">
                            <% _.each(deviceTypes,function(net) {
                                if(net.id == deviceType.id){ %>
                            <option value="<%= net.id %>" selected="selected"> <%= net.name %> </option>
                            <%}else{ %>
                                    <option value="<%= net.id %>"> <%= net.name %> </option>
                            <%}}); %>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-lg-3 control-label">Data:</label>
                    <div class="col-lg-9">
                        <div class="device-value form-static-text"><%= data%></div>
                        <textarea class="new-value data form-control"><%= data%></textarea>
                        <span id="data-format-error" class="validation-errors">Data should be valid Json</span>
                    </div>
                </div>
            </div>
        </div>
        <div class="panel-footer">
            <a href="javascript:void(0)" class="edit-device btn btn-primary">edit</a>
            <a href="javascript:void(0)" class="save-device btn btn-success">save</a>
            <a href="javascript:void(0)" class="close-action btn btn-warning">close without saving</a>
        </div>
    </div>
</script>
